package mutsumimod.cards.stand;

import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.actions.watcher.WallopAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import mutsumimod.actions.TriggerStandAction;
import mutsumimod.cards.BaseCard;
import mutsumimod.character.Mutsumi;
import mutsumimod.powers.BreakPower;
import mutsumimod.util.CardStats;

public class IsDoctor extends BaseCard {
    public static final String ID = makeID(IsDoctor.class.getSimpleName());
    public static final CardStats info = new CardStats(
            Mutsumi.Meta.CARD_COLOR,
            CardType.SKILL,
            CardRarity.COMMON,
            CardTarget.SELF,
            1
    );

    public IsDoctor() {
        super(ID, info);
        setAttr(0,0,3);
        setAttrUpg(0,0,1);
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        stand(p.hand.size(),new GainBlockAction(p,block));
    }

    @Override
    public void applyPowers() {
        calculateBaseBlock();
        updateDescription();
        super.applyPowers();
    }

    public void calculateBaseBlock() {
        if(AbstractDungeon.player==null) {
            baseBlock=0;
        }else{
            baseBlock = AbstractDungeon.player.hand.size() * magicNumber;
        }
    }

    @Override
    public void updateDescription() {
        if(AbstractDungeon.player==null){
            rawDescription=cardStrings.DESCRIPTION;
        }else{
            rawDescription=cardStrings.DESCRIPTION+cardStrings.EXTENDED_DESCRIPTION[0]+
                    AbstractDungeon.player.hand.size()+cardStrings.EXTENDED_DESCRIPTION[1];
        }
        initializeDescription();
    }

    @Override
    public AbstractCard makeCopy() {
        return new IsDoctor();
    }
}
